package com.whmall.service.crm.enumeration;

/**
 * @author Esion
 * @since 2021/8/23
 */
public enum FecaQueryDataCycleEnum {

    // 前端成本核算查询数据周期
    A_MONTH_AGO(1, "一个月以前"),
    A_YEAR_AGO(2, "一年以前");

    private Integer value;

    private String name;

    FecaQueryDataCycleEnum(Integer value, String name) {
        this.value = value;
        this.name = name;
    }

    public Integer getValue() {
        return value;
    }

    public void setValue(Integer value) {
        this.value = value;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static FecaQueryDataCycleEnum getByValue(Integer value){
        for (FecaQueryDataCycleEnum item : values()) {
            if (item.getValue().equals(value)){
                return item;
            }
        }
        return null;
    }

    public static FecaQueryDataCycleEnum getByValueWithNull(Integer value){
        FecaQueryDataCycleEnum temp = getByValue(value);
        if (temp == null){
            throw new IllegalArgumentException("错误的前端成本核算查询数据周期类型：" + value);
        }
        return temp;
    }

}
